#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;

        vector<string>st;
        for (int i = 0; i < n; i++)
        {

            string str;
            cin >> str;
            st.push_back(str);


        }
        int left = 0, right = st.size() - 1;
        while (left < right)
        {
            int hash1[26] = { 0 };
            int hash2[26] = { 0 };
            for (auto e : st[left])
            {
                hash1[e - 'a']++;

            }
            for (auto e : st[right])
            {
                hash2[e - 'a']++;

            }
            int flag = 0;
            for (int i = 0; i < 26; i++)
            {
                if (hash1[i] == hash2[i])
                {
                    flag = 1;
                }

            }
            if (flag == 1) { left++; right--; }
            else break;

        }
        if (n == 1)
        {
            cout << "Yes" << endl;
           

        }
        else if (left < right)cout << "Yes" << endl;
        else cout << "No" << endl;
    }

}
#include <iostream>
using namespace std;
int gcb(int x, int y) {

    int m;
    int sum = x * y;
    while (m = x % y) { // 12%5=2     m=2     m=1     m=0

        x = y;         //m=2         x=5   y=2        x=2   y=1
        y = m;
    }
    cout << y;
    return y;

}
int main() {
    int n;
    long long x;
    while (cin >> n >> x) {
        for (int i = 0; i < n; i++) {
            long long a;
            cin >> a;
            if (x >= a) {
                x += a;


            }
            else {

                x += gcb(x, a);


            }


        }
        // cout<<x;
    }


}class Solution {
public:

    int maxValue(vector<vector<int> >& grid) {
        int m = grid.size();
        int n = grid[0].size();
        vector<vector<long long>>dp(m, vector<long long>(n, 0));
        dp[0][0] = grid[0][0];
        for (int i = 1; i < n; i++) {
            dp[0][i] = dp[0][i - 1] + grid[0][i];
        }
        for (int j = 1; j < m; j++) {
            dp[j][0] = dp[j - 1][0] + grid[j][0];
        }

        for (int i = 1; i < m; i++) {
            for (int j = 1; j < n; j++) {
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + grid[i][j];




            }
        }


        return dp[m - 1][n - 1];





    }
};